﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace EmployeeCheckIn
{
    public partial class _Default : System.Web.UI.Page
    {   
        string UserDB,PassDB;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Label2.Text = ":User";
                Label1.Text = ":PASS";
            }
            if (Session["UserBack"] != null)
            {
                txtUserName.Text = Session["User"].ToString();
            }
        }

        protected void btLogIn_Click(object sender, EventArgs e)
        {
            Log_in in_log = new Log_in();
            string U= txtUserName.Text;
            string P = txtPassWord.Text;
            DataTable dt = in_log.GetData(U,P);
            
            if (dt != null && dt.Rows.Count > 0)
            {
                UserDB = dt.Rows[0]["user_name"].ToString();
                PassDB = dt.Rows[0]["user_password"].ToString();
                Session["User"] = txtUserName.Text;
                Server.Transfer("EmpDetail.aspx");   
                //Response.Redirect("EmpDetail.aspx");               
            }
            else
            {
                 
                 lbResponse.Text = "User or Pass invalid";
                
               
            }
           
        }

        protected void lbRegister_Click(object sender, EventArgs e)
        {
            //หำ
            //หำ2 222 2 2 2 2 2
            Response.Redirect("RegisterPage.aspx");
        }
        
	
		 
	}
    }

